{% extends "base.html" %}

{%block title%}Lista pacjentów{%endblock%}

{% block content %}
	<div id="content">
		<h2>Lista pacjentów</h2>
		<div class="f-l">
			<span class="m-l"><b>Sortuj:</b></span> <a href="?sort=asc&item={{param.item}}&page={{param.page}}&query={{param.query}}">Rosnąco</a>
				| <a href="?sort=desc&item={{param.item}}&page={{param.page}}&query={{param.query}}">Malejąco</a>
			<span class="m-l"><b>Wyświetl:</b></span> <a href="?item=25&sort={{param.sort}}&page={{param.page}}&query={{param.query}}">25</a>
				| <a href="?item=50&sort={{param.sort}}&page={{param.page}}&query={{param.query}}">50</a>
				| <a href="?item=75&sort={{param.sort}}&page={{param.page}}&query={{param.query}}">75</a>
		</div>
		<form method="POST" action="" class="f-r m-r">
			{% csrf_token %}
			<span class="m-l"><b>Szukaj:</b></span> <input type="text" name="query" value="{{param.query}}" /> <button type="submit">Szukaj</button>
		</form>
		<br />
		<br class="clearfix" />
		<table class="results">
			<tr>
				<th>Lp.</th>
			    <th>Imię</th>
				<th>Nazwisko</th>
				<th>Edytuj</th>
				<th>Usuń</th>
				<th>Pokaż</th>
			</tr>
			{%for p in archives%}
			<tr>
				<td>{{forloop.counter}}.</td>
				<td>{{p.first_name}}</td>
				<td>{{p.last_name}}</td>
				<td><a href="{%url profile-edit p.id%}"><img src="{{MEDIA_URL}}/images/edit.png" alt="Edytuj" title="Edytuj: {{p.first_name}} {{p.last_name}}"/></a></td>
				<td><a href="{%url profile-remove p.id%}"><img src="{{MEDIA_URL}}/images/remove.png" alt="Usuń" title="Usuń: {{p.first_name}} {{p.last_name}}"/></a></td>
				<td><a href="{%url profile-show p.id%}"><img src="{{MEDIA_URL}}/images/info.png" alt="Pokaż" title="Pokaż: {{p.first_name}} {{p.last_name}}"/></a></td>
			</tr>
			{%empty%}
			<tr>
				<td colspan="6">Brak danych</td>
			</tr>
			{%endfor%}
			<tr>
				<td class="ta-c" colspan="6">
					{%if archives.has_previous%}
						<a href="?page={{archives.previous_page_number}}&sort={{param.sort}}&item={{param.item}}&query={{param.query}}">&laquo;</a>
					{%endif%}
					Strona <b>{{archives.number}}</b> z <b>{{archives.paginator.num_pages}}</b>
					{%if archives.has_next%}
						<a href="?page={{archives.next_page_number}}&sort={{param.sort}}&item={{param.item}}&query={{param.query}}">&raquo;</a>
					{%endif%}
				</td>
			</tr>
		</table>
	</div>
{% endblock %}
